Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(combobox): Do not clear the input when no item is selected #2289

Merged
merged 2 commits into from
Jul 17, 2023

Conversation

NicholasBoll
Copy link
Member

Summary

Removes the accidental logic that closes the menu and clears the input when no item is selected.

Fixes: #2288

Release Category

Components


Checklist

  • MDX documentation adheres to Canvas Kit's standard MDX template
  • Label ready for review has been added to PR

For the Reviewer

  • PR title is short and descriptive
  • PR summary describes the change (Fixes/Resolves linked correctly)

Where Should the Reviewer Start?

Areas for Feedback? (optional)

  • Code
  • Testing

Testing Manually

Go to the Autocomplete example and type "Peach" and hit the enter key. It should not clear the input

@NicholasBoll NicholasBoll added the ready for review Code is ready for review label Jul 17, 2023
if (
document
.querySelector(`[data-id="${model.state.cursorId}"]`)
?.getAttribute('aria-disabled') !== 'true'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this chaining?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally the conditional was:

document.querySelector(`[data-id="${model.state.cursorId}"]`)

"If the element exists, continue". Later we added the requirement that the element should not be disabled via aria-disabled. The updated logic turned out to be "If the element exists AND is not disabled OR the element does not exist" when it should be "If the element exists AND is not diabled"

@cypress
Copy link

cypress bot commented Jul 17, 2023

1 flaky tests on run #5968 ↗︎

0 918 2 0 Flakiness 1

Details:

Merge 90854be into 1fd1ede...
Project: canvas-kit Commit: 44f92d707f ℹ️
Status: Passed Duration: 07:32 💡
Started: Jul 17, 2023 9:53 PM Ended: Jul 17, 2023 10:01 PM
Flakiness  cypress/integration/Autocomplete.spec.ts • 1 flaky test

View Output Video

Test Artifacts
... > when a value is entered > when down arrow key is pressed > when the user presses the enter key > when the use hits the "2" key > should change the filtered results Output Screenshots Video

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@alanbsmith alanbsmith merged commit 98e33d5 into master Jul 17, 2023
13 checks passed
@alanbsmith alanbsmith deleted the fix/do-no-close-combobox branch July 17, 2023 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge ready for review Code is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Combobox Input selects and closes on enter key when no menu item is highlighted
3 participants